package com.weaver.drools.business.execution.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.weaver.drools.business.execution.service.IASfDetailsandemployee1048Service;
import com.weaver.drools.common.dao.ASfDetailsandemployee1048Dao;
import com.weaver.drools.common.entity.ASfDetailsandemployee1048;
@Service
public class ASfDetailsandemployee1048ServiceImpl implements IASfDetailsandemployee1048Service {
	
	@Autowired
	private ASfDetailsandemployee1048Dao detailsandemployee1048Dao;
	@Override
	public ASfDetailsandemployee1048 findById(Long detailsandemployeeid) {
		// TODO Auto-generated method stub
		return detailsandemployee1048Dao.findASfDetailsandemployee1048ByDetailsandemployeeid(detailsandemployeeid);
	}

	@Override
	public void saveASfDetailsandemployee1048(ASfDetailsandemployee1048 detailsandemployee1048) {
		detailsandemployee1048Dao.saveOrUpdate(detailsandemployee1048);

	}

	@Override
	public void updateASfDetailsandemployee1048(ASfDetailsandemployee1048 detailsandemployee1048) {
		detailsandemployee1048Dao.saveOrUpdate(detailsandemployee1048);

	}

	@Override
	public void deleteById(Long detailsandemployeeid) {
		detailsandemployee1048Dao.deleteById(detailsandemployeeid);

	}

	@Override
	public List<ASfDetailsandemployee1048> findEmployeeListByAccidentDetailsId(Long accidentDetailsId, String isLeaders)
			throws Exception {
		String hql="from ASfDetailsandemployee1048 where isdeleted=0";
		if(accidentDetailsId!=null){
			hql+=" and ASfAccidentdetails1039.accidentdetailsid="+accidentDetailsId;
		}
		if(isLeaders!=null){
			hql+=" and isleaders="+isLeaders;
		}
		hql+=" order by detailsandemployeeid asc";
		return detailsandemployee1048Dao.findListByhql(hql);
	}

}
